@extends('default.layouts.simple_vice_head_foot')
@section('title'){{ $jobinfo->job_title.'recruit'.(empty($jobinfo->recruiting_num)?'Some':$jobinfo->recruiting_num).'name_'.$jobinfo->company_basic->company_name.'_'.Site::get('webname') }} @endsection
@section('insert_css')
    {{--添加样式表--}}
    <link rel="stylesheet" href="{{asset('/default/css/index/vice_public.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/index/jobinfo.css')}}">
    <link rel="stylesheet" href="{{asset('/default/css/index/station.css')}}">
@endsection
@section('content')
    {{--副页菜单模版--}}
    @include('default.layouts.index_vice_mune')
    {{--分站列表--}}
    @include('default.layouts.station')
    {{--内容区显示区--}}
    <div class="vicecontent">
        {{--阴影线--}}
        <div class="shadow_line"></div>
        <div class="content_area">
            <div class="job_display">
                {{--left--}}
                <div class="job_display_left border">
                    <div class="frist_info border_buttom">
                        <span class="left-title">
                            <h1>
                                <span>{{str_limit($jobinfo->job_title,36)}}</span>
                                @if(!empty($jobinfo->part_status) && $jobinfo->part_status == '2')
                                    <i class="one"></i>
                                @elseif(!empty($jobinfo->part_status) && $jobinfo->part_status == '3')
                                    <i class="two"></i>
                                @elseif(!empty($jobinfo->part_status) && $jobinfo->part_status == '4')
                                    <i class="three"></i>
                                @endif
                            </h1>
                            <p><em></em> {{ $jobinfo->salary_above }}</p>
                        </span>
                        <span class="right-button"><input type="button" class="{{ $applyJobButton }}"
                                                          value="{{trans('english.deliver')}}"></span>
                        {{--招聘信息--}}
                        <span class="job-info">
                            <p class="adress"><i></i><span>{{trans('english.detailedAddress')}}</span><em>{{ $jobinfo->company_basic->address }}</em><a
                                        id="busLine">{{trans('english.Query')}}</a></p>
                        </span>
                        <ul class="job-list">
                            <li>
                                <i class="ico1"></i><span>{{trans('english.department')}}</span><em>{{ empty($jobinfo->dePartMent)?'Unlimited':$jobinfo->dePartMent}}</em>
                            </li>
                            <li>
                                <i class="ico2"></i><span>{{trans('english.Recruit')}}</span><em>{{ empty($jobinfo->recruiting_num)?"Several":$jobinfo->recruiting_num.'人' }}</em>
                            </li>
                            <li>
                                <i class="ico3"></i><span>{{trans('english.Education')}}</span><em>{{ empty($jobinfo->education)?'Unlimited':$jobinfo->dePartMent }}</em>
                            </li>
                            <li>
                                <i class="ico4"></i><span>{{trans('english.Hands-on')}}</span><em>{{ empty($jobinfo->work_year)?'Unlimited':$jobinfo->work_year }}</em>
                            </li>
                            <li>
                                <i class="ico5"></i><span>{{trans('english.Gender')}}</span><em>{{ empty($jobinfo->gender)?'Unlimited':$jobinfo->gender }}</em>
                            </li>
                            <li>
                                <i class="ico6"></i><span>{{trans('english.age')}}</span><em>{{ empty($jobinfo->age)?'Unlimited':$jobinfo->age }}</em>
                            </li>
                        </ul>
                        {{--福利--}}
                        <span class="job-welfare">
                            @if(count($jobinfo->welfare) > 0 && is_array($jobinfo->welfare) )
                                @foreach($jobinfo->welfare as $v)
                                    <i>{{ $v }}</i>
                                @endforeach
                            @endif
                        </span>
                        {{--发布时间与收藏分享--}}
                        <span class="left-time"><i></i>{{$jobinfo->addtime}}</span>
                        <span class="right-favorite">
                            @if($favoritesStatus==0)
                                <a href="#" class="favorite {{ $favoritesBtton }}"><p><em></em>{{trans('english.Collection')}}</p></a>
                            @else
                                <p class="favorite {{ $favoritesBtton }} haveFavorite"><em></em>{{trans('english.Collection')}}</p>
                            @endif
                            <a id="toShare" class="share"><p><em></em>{{trans('english.share')}}</p></a>
                        </span>
                    </div>
                    {{--职位发布者--}}
                    <div class="publisher">
                        <ul>
                            <li class="title"><em class="sign"></em><i>{{trans('english.publisher')}}</i></li>
                            <li class="publisher_info">
                                <span class="img-box"><img src="{{ asset($jobinfo->logo) }}"></span>

                                <span class="info">
                                    <h3>{{ $jobinfo->contacts or '保密' }}</h3>
                                    <p class="job-position">{{ $jobinfo->dePartMent or ''}}</p>
                                    <span class="publisher-contact">
                                        @if($contactInfo==1)
                                            <em id="thShowContact">{{ $contactMobile  }}</em>
                                        @elseif($contactInfo==2)
                                            @if(auth()->guard('personal')->check())
                                                <em id="thShowContact">{{ $contactMobile  }}</em>
                                            @else
                                                <em id="thShowContact">{{ $contactMobile  }}</em>
                                                <a id="showContantButton" class="{{ $contactButton or '' }}">[ {{trans('english.See')}} ]</a>
                                            @endif
                                        @elseif($contactInfo==3)
                                            @if(auth()->guard('personal')->check())
                                                @if($to_view==1)
                                                    <em id="thShowContact">{{ $contactMobile  }}</em>
                                                @elseif($to_view==2)
                                                    <em id="thShowContact">{{ $contactMobile  }}</em>
                                                    <a id="showContantButton"
                                                       onclick="to_view('{{$jobid}}','{{$to_view}}')">[ {{trans('english.See')}} ]</a>
                                                @elseif($to_view==3)
                                                    <em id="thShowContact">{{ $contactMobile  }}</em>
                                                    <a id="showContantButton"
                                                       onclick="to_view('{{$jobid}}','{{$to_view}}')">[ {{trans('english.See')}} ]</a>
                                                @endif
                                            @else
                                                <em id="thShowContact">{{ $contactMobile  }}</em>
                                                <a id="showContantButton" onclick="dispense()">[ {{trans('english.See')}} ]</a>
                                            @endif
                                        @else
                                            <em id="thShowContact">{{ $contactMobile  }}</em>
                                            <a id="showContantButton" class="{{ $contactButton or '' }}">[ {{trans('english.See')}} ]</a>
                                        @endif
                                    </span>
                                </span>
                                <span class="work-efficiency">
                                    <h3>{{ $resumeRecoveryRate }}</h3>
                                    <p>Resume average rate<em></em></p>
                                </span>
                                <span class="work-efficiency">
                                    <h3 class="bo-right-border">{{ $last_login_time or '' }}</h3>
                                    <p class="bo-right-border">Latest logon time</p>
                                </span>
                            </li>
                        </ul>
                    </div>

                    {{--职位描述--}}
                    <div class="job_describe biggray border_buttom">
                        <ul>
                            <li class="title"><em class="sign"></em><i>{{trans('english.desc')}}</i></li>
                            <li>
                                <div class="describe">{!! nl2br(e($jobinfo->description)) !!}</div>
                            </li>
                        </ul>
                    </div>
                    {{--公司简介--}}
                    @if(count($photo)>0)
                        <div class="company biggray border_buttom">
                            <ul>
                                <li class="title"><em class="sign"></em><i>{{trans('english.Album')}}</i></li>
                                <li>
                                    <div class="describe">
                                        <div id="pic_list_1" class="scroll_horizontal">
                                            <div class="box" id="phoneBox">
                                                <ul class="list">
                                                    @foreach($photo as $k => $v)
                                                        @if(!empty($v))
                                                            <li>
                                                                <img layer-src="{{asset('upload/companyphoto/'.$v['file'])}}"
                                                                     src="{{asset('upload/companyphoto/'.$v['file'])}}"
                                                                     width="220" height="166"
                                                                     alt="{{ $v['remark'] or '' }}"></li>
                                                        @endif
                                                    @endforeach
                                                </ul>
                                            </div>
                                        </div>
                                    </div>
                                </li>
                            </ul>
                        </div>
                    @endif
                    {{--推荐职位--}}
                    <div class="recommend">
                        <ul>
                            <li class="title"><i>Other positions in the company</i></li>
                            <li class="recommend_list">
                                <div class="describe">
                                    <div class="middle_info">
                                        @if(count($recommendedjob) >0 )
                                            @foreach($recommendedjob as $k=>$v)
                                                <div class="saith">
                                                    <ul class="father_ul">
                                                        <li>
                                                            <ul class="son_ul father_ul1_position">
                                                                <li class="list1"><a
                                                                            href="{{url('jobinfo_'.idEncryption($v->id).'.html')}}">{{str_limit($v->job_title,20)}}</a>
                                                                    @if(!empty($v->part_status) && $v->part_status == '2')
                                                                        <i class="one"></i>
                                                                    @elseif(!empty($v->part_status) && $v->part_status == '3')
                                                                        <i class="two"></i>
                                                                    @elseif(!empty($v->part_status) && $v->part_status == '4')
                                                                        <i class="three"></i>
                                                                    @endif
                                                                    @if($v->urgent==1)<span>wanted</span>@endif</li>
                                                                <li class="list2">{{ $v->salary_above }}</li>
                                                                <li class="list4"><a
                                                                            href="{{url('comabout_'.idEncryption($v->company_basic->id).'.html')}}"
                                                                            target="_blank">{{str_limit($v->company_basic->company_name,32)}}</a>
                                                                </li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <ul class="son_ul">
                                                                <li class="list1 son_list2_refont">{{ $v->location1 }}{{ empty($v->work_year)? '' :'/'.$v->work_year.'经验' }}{{empty($v->education)?'':'/'.$v->education}}</li>
                                                                <li class="list2 son_list2_refont">{{$v->addtime}}</li>
                                                                <li class="list4 son_list2_refont">{{empty($v->industry) ? '':$v->industry.' | '}}{{ $v->employee_num  }}</li>
                                                            </ul>
                                                        </li>
                                                        <li>
                                                            <ul class="son_ul">
                                                                <li class="list">{!! $v->welfare !!}</li>
                                                            </ul>
                                                        </li>
                                                    </ul>
                                                </div>
                                            @endforeach
                                        @endif
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="more_recommend"><input type="button" id="more_job" value=" More>>"></div>
                </div>{{--end left--}}

                {{--right--}}
                <div class="job_display_right border">
                    <div class="company_info">
                        <ul>
                            <li class="img">
                                <a href="{{url('comabout_'.idEncryption($jobinfo->company_basic->id).'.html')}}">
                                    <img src="{{asset($jobinfo->logo)}}">
                                </a>
                            </li>
                            <li class="title">
                                <a href="{{url('comabout_'.idEncryption($jobinfo->company_basic->id).'.html')}}"
                                   class="titleLink">{{str_limit(!empty($v->company_basic->company_name) ? $v->company_basic->company_name : '',12) }}</a>
                                @if(!empty($v->company_basic->cert_status ))
                                    @if($v->company_basic->cert_status == '1' )
                                        <em class="verified"></em>
                                    @else
                                        <em class="no_verified"></em>
                                    @endif
                                @else
                                    <em class="no_verified"></em>
                                @endif
                            </li>
                        </ul>
                    </div>
                    <div class="company_recommend">
                        @if(!empty($jobinfo->company_basic->id) && !empty($v->company_basic->profile))
                            <a href="{{url('comabout_'.idEncryption($jobinfo->company_basic->id).'.html')}}">{{ str_limit($v->company_basic->profile,300) }}</a>
                        @endif
                    </div>
                    <div class="company_list">
                        <ul>
                            <li class="left">{{trans('english.industry')}}</li>
                            <li class="right">{{str_limit($jobinfo->industry,24)}}</li>
                        </ul>
                        <ul>
                            <li class="left">{{trans('english.Nature')}}</li>
                            <li class="right">{{$jobinfo->company_basic->comkind}}</li>
                        </ul>
                        <ul>
                            <li class="left">{{trans('english.scale')}}</li>
                            <li class="right">{{$jobinfo->company_basic->employee_num}}</li>
                        </ul>
                    </div>
                    {{--留言--}}
                    {{--<div class="company_message">--}}
                    {{--<ul>--}}
                    {{--<li><textarea id="message_content" placeholder="给我留言......"></textarea></li>--}}
                    {{--<li class="status">--}}
                    {{--<i id="message_num">0/200</i>--}}
                    {{--<input type="button" value="发送">--}}
                    {{--</li>--}}
                    {{--</ul>--}}
                    {{--</div>--}}
                    {{--其它职位--}}
                    <div class="other_positions">
                        <div class="title">Recom position</div>
                        <div class="positions_list">
                            @if(count($right_jobinfo) > 0)
                                @foreach($right_jobinfo as $k => $right_jobinfo_value)
                                    <ul @if(count($right_jobinfo) == $k+1) class="border_buttom_none" @endif>
                                        <li class="left">
                                            @if(!empty($right_jobinfo_value->company_basic->logo))
                                                <img src='{{ asset("upload/companylogo/".$right_jobinfo_value->company_basic->logo) }}'>
                                            @else
                                                <img src='{{ asset('/default/images/index/default_company_img.jpg') }}'>
                                            @endif
                                        </li>
                                        <li class="right">
                                            <p class="font14 darkgray"><a
                                                        href="{{url('jobinfo_'.idEncryption($right_jobinfo_value->id).'.html')}}">{{ str_limit($right_jobinfo_value->job_title,20)}}</a>
                                            </p>
                                            <span class="font12 gray">{{ $right_jobinfo_value->salary_above }}</span>
                                        </li>
                                    </ul>
                                @endforeach
                            @endif
                        </div>
                    </div>
                    <div class="more"><a href="{{url('/job?anxious=on')}}">>>More</a></div>
                </div>{{--end right--}}
            </div>
        </div> {{--end 内容显示--}}
    </div>
    <div class="vicebuttom"></div>
    {{--浮动层--}}
    {{--@include('default.layouts.floating')--}}
@endsection
@section('insert_js')
    @parent
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.form.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.validate.extend.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.enplaceholder.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/personal/move.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/index/ejectlogin.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/index/index_public.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.cxscroll.min.js')}}"></script>
    <script type="text/javascript" src="{{Resources::jsOption(['education'])}}"></script>
    {{--工作岗位--}}
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.position.js')}}"></script>
    {{--工作地区--}}
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.area.js')}}"></script>
    <!--弹出层显示时间加载插件-->
    <script type="text/javascript" src="{{asset('/default/js/jquery/jquery.autoTime.js')}}"></script>
    <script type="text/javascript" src="{{asset('/default/js/index/reginfo.js')}}"></script>

    <script>

    </script>

    <script>
        //加载登录事件
        var postUrl = "{{ url('personal/ajax_login') }}";
        var _token = "{{csrf_token()}}";
        var ajaxMobileLogin = "{{ url('personal/ajax_mobile_login') }}";
        //短信验证发送
        var codeUrl = "{{ url('common/ajax_code') }}";
        var imgCode = "{{captcha_src('code')}}" + Math.random();
        var mobCodeUrl;

        $(function(){
            //查看联系方式
            $(".personlogin").click(function(){
                //留下基本信息面试通知
                dispense();
            });
        });
        //已有账号登录
        function haveLgoin(){
            layer.closeAll();
            mobCodeUrl = "{{ url('personal/ajax_mob_login_code') }}";
            $.personEject({
                className: "personlogin",
                QQLogin: "{{ Site::get('personAppid') }}",
                QQUrl: "{{ url("personal/qqlogin") }}",
                weiXin:"{{ Site::get('mpPersonOpenAppID') }}",
                weiXinUrl: "{{ weiXinlogin('personal') }}",
                csrf: "{{ csrf_token() }}",
                callBack: function(status){}
            });
        }

        $(document).ready(function(){
            //留言输入
            $("#message_content").keyup(function(){
                mvalue = $("#message_content").val().length;
                r_value = $("#message_content").val().substring(0, 200);
                mvalue <= 200 ? '' : $("#message_content").val(r_value);
                mvalue <= 200 ? $("#message_num").text(mvalue + '/200') : $("#message_num").html(200 + '/200 :<em>最多200个字!<em>');
            });

            //申请职位
            $(".applyjob").click(function(){
                $.ajax({
                    url: "{{ url("personal/applyjob") }}",
                    dataType: "json",
                    data: "jobid={{$jobid}}",
                    type: "GET",
                    time: 0,
                    success: function(data){
                        switch(data.status){
                            case 0:
                                $(".applyjob").val('Have post');
                                layer.msg(data.msg, {icon: 6});
                                if(data.showStatus){
                                    $("#thShowContact").html(str_trim(data.contact.mobile + ' , ' + data.contact.phone, ','));
                                    $("#showContantButton").remove();
                                }
                                return true;
                                break;
                            case 1:
                                layer.msg(data.msg, {icon: 5});
                                break;
                            case 2:
                                layer.confirm(data.msg, {icon: 3, title: '提示'}, function(index){
                                    //do something
                                    location.href = "{{ url("/personal/my_resume") }}";
                                    layer.close(index);
                                });
                                break;
                            default:
                                layer.msg(data.msg, {icon: 5});
                                break;
                        }
                    },
                    error: function(data){
                        var msgErr = '';
                        var errors = $.parseJSON(data.responseText);
                        $.each(errors, function(index, value){
                            msgErr += value + ";<br>";
                        });
                        layer.msg(msgErr, {icon: 5});
                    },
                    complete: function(){
                    }
                });
                return false;
            });
            //收藏
            $(".personFavorites").click(function(){
                $.ajax({
                    url: "{{ url("personal/personfavorites") }}",
                    dataType: "json",
                    data: "jobid={{$jobid}}&comid={{$company_id}}",
                    type: "GET",
                    time: 0,
                    success: function(data){
                        switch(data.status){
                            case 0:
                                layer.msg(data.msg, {icon: 6});
                                $('.right-favorite').find("p").eq(0).attr("class", "favorite personFavorites haveFavorite");
                                return true;
                                break;
                            case 1:
                                layer.msg(data.msg, {icon: 5});
                                $('.right-favorite').find("p").eq(0).attr("class", "favorite personFavorites");
                                break;
                            default:
                                layer.msg(data.msg, {icon: 5});
                                break;
                        }
                    },
                    error: function(data){
                        var msgErr = '';
                        var errors = $.parseJSON(data.responseText);
                        $.each(errors, function(index, value){
                            msgErr += value + ";<br>";
                        });
                        layer.msg(msgErr, {icon: 5});
                    },
                    complete: function(){
                    }
                });
                return false;
            });

            //分享
            $("#toShare").click(function(){
                layer.open({
                    type: 1,
                    title: '分享朋友圈',
                    skin: 'layer-toshare',
                    area: ['240px', '295px'],
                    resize: false,
                    move: false,
                    btn: false,
                    content: '<div><img src="{{url('to_share?job_id='.$jobid)}}"></div><div style="text-align: center">扫一扫分享到朋友圈</div>'
                });
            });

        });

        //更多跳转
        $("#more_job").click(function(){
            location.href = "{{url('/job?keyword=').$jobinfo->company_basic->company_name}}";

        });

        //右边浮动框
        function defineRightFloat(){
            var w = document.body.clientWidth;
            var h = $(window).height();
            var obj = $("#adright");
            if(w > (1200 + (obj.width() * 1.5)) + 15){//可视界面 如果大于1200+元素宽1.5倍
                fix_w = parseFloat((w - 1200) / 2) + 1200 + 15;
            }else{//小于则紧贴右边缘
                fix_w = parseFloat(w - obj.width());
            }
            fix_h = parseFloat(h / 3);
            obj.css("left", fix_w + "px");
            obj.css('top', fix_h + "px");
        }

        window.onload = function(){
            window.onresize = defineRightFloat;
            defineRightFloat();
        }
        $("#pic_list_1").cxScroll();
        //关闭对话框
        function lookclose(){
            layer.closeAll();
        }
        //点击弹出大图
        layer.ready(function(){
            layer.photos({
                photos: '#phoneBox',
                shift: 5 //0-6的选择，指定弹出图片动画类型，默认随机
            });
        });
        //查看公交线路
        $(function(){
            $("#busLine").click(function(){
                var index = parent.layer.getFrameIndex("baiduMap");
                layer.open({
                    type: 1,
                    title: '查看公交路线',
                    skin: 'layer-toshare',
                    area: ['865px', '570px'],
                    resize: false,
                    move: false,
                    btn: false,
                    content: '<iframe frameborder="0" name="baiduMap" id="baiduMap" width="820" height="500" src="{{ route("baiduMap",["cid"=>idEncryption($jobinfo->company_basic->id)]) }}" scrolling="no"></iframe>'
                });
            });
        });
    </script>
@endsection
